<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('计划执行列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>项目编码：</label>
                                <input type="text" name="planProject"/>
                            </li>
                            <li>
                                <label>部套编码：</label>
                                <input type="text" name="planSet"/>
                            </li>
                            <li>
                                <label>零件编码：</label>
                                <input type="text" name="planPart"/>
                            </li>
                            <li>
                                <label>工序编码：</label>
                                <input type="text" name="planProcedure"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.edit()" shiro:hasPermission="product:plan:edit">
                    二次派工
                </a>
                <a class="btn btn-danger" onclick="$.operate.add()" shiro:hasPermission="product:plan:add">
                    拆单派工
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="product:switch:export">
                    报工提交
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('product:plan:edit')}]];
        var removeFlag = [[${@permission.hasPermi('product:plan:remove')}]];
        var prefix = ctx + "product/plan";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "计划执行",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'planState',
                    title: '状态',
                    formatter: function (value, row, index)
                    {
                        if (value === "已分配到班组") { return "<strong><font color=\"green\">" + value+"</font></strong>"; }
                        if (value === "已分配到个人") { return "<strong><font color=\"red\">" + value+"</font></strong>"; }
                        // if (value === "已分配到班组") { return "<font style='background: darkblue'>" + value+"</font>"; }
                        // if (value === "已分配到个人") { return "<font style='background: red'>" + value+"</font>"; }
                    }

                },
                {
                    field: 'planProject',
                    title: '项目编码'
                },
                {
                    field: 'planSet',
                    title: '部套编码'
                },
                {
                    field: 'planPart',
                    title: '零件编码'
                },
                {
                    field: 'planProcedure',
                    title: '工序编码'
                },
                {
                    field: 'weldingCode',
                    title: '焊缝编码',
                    align: "center"
                },
                {
                    field: 'weldingMethod',
                    title: '焊接方法'
                },
                {
                    field: 'weldingMaterial',
                    title: '焊接材料'
                },
                {
                    field: 'specifications',
                    title: '规格'
                },
                {
                    field: 'electricCurrent',
                    title: '电流/安培(A)'
                },
                {
                    field: 'voltage',
                    title: '电压/伏特(V)'
                },
                {
                    field: 'welder',
                    title: '焊工'
                },
                {
                    field: 'weldingTime',
                    title: '派单时间'
                },
                {
                    field: 'remarks',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')">领单</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')">退单</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>